<?php

namespace app\http\middleware;

class CheckAdminLogin
{
    public function handle($request, \Closure $next)
    {
        //因为Login控制器是不需要做session验证
        $controller=$request->controller();  //获取当前访问的url地址的控制器
        if($controller!='Login' && !session('?admin_id')){
            return redirect('admin/login/login');
        }
        return $next($request);
    }
}
